import 'package:backend.core/core/domain/entities/app_store/app_store_transaction_ownership_type.dart';
import 'package:backend.purchases/domain/entities/app_store_api/app_store_api_transaction_ownership_type.dart';

abstract class CreateAppStoreTransactionOwnershipTypeFromApiOne {
  AppStoreTransactionOwnershipType call({
    required AppStoreApiTransactionOwnershipType apiOwnershipType,
  });
}

class CreateAppStoreTransactionOwnershipTypeFromApiOneImpl
    implements CreateAppStoreTransactionOwnershipTypeFromApiOne {
  const CreateAppStoreTransactionOwnershipTypeFromApiOneImpl();

  @override
  AppStoreTransactionOwnershipType call({
    required AppStoreApiTransactionOwnershipType apiOwnershipType,
  }) {
    switch (apiOwnershipType) {
      case AppStoreApiTransactionOwnershipType.purchase:
        return AppStoreTransactionOwnershipType.purchase;
      case AppStoreApiTransactionOwnershipType.familySharing:
        return AppStoreTransactionOwnershipType.familySharing;
    }
  }
}
